#ifndef lcd_xh_H
#define	lcd_xh_H

#include "stdint.h"
#include "mytype.h"

#ifdef	__cplusplus
extern "C" {
#endif

#define TEXT_X_LEFT     0x00       
#define TEXT_X_MID      0x01       
#define TEXT_X_RIGHT    0x02       
#define TEXT_Y_UP       (0x00<<2)  
#define TEXT_Y_MID      (0x01<<2)  
#define TEXT_Y_DOWN     (0x02<<2)  

#define TEXT_MID        (TEXT_X_MID | TEXT_Y_MID)
#define TEXT_LEFT_DOWN  (TEXT_X_LEFT | TEXT_Y_DOWN)
#define TEXT_LEFT_UP    (TEXT_X_LEFT | TEXT_Y_UP)
#define TEXT_RIGHT_DOWN  (TEXT_X_RIGHT | TEXT_Y_DOWN)
#define TEXT_RIGHT_UP    (TEXT_X_RIGHT | TEXT_Y_UP)

#define TEXT_SQ_W(n)    ((n)<<4)       
#define TEXT_SQ_PX(n)   ((n)<<6)       
#define TEXT_SQ_PY(n)   ((n)<<9)       
#define TEXT_SQ(w,px,py)    (TEXT_SQ_W(w) | TEXT_SQ_PX(px) | TEXT_SQ_PY(py))

#define TEXT_LINE_N(n)  ((n)<<12)       
#define TEXT_LINE_W(n)  ((n-1)<<14)      
#define TEXT_LINE(w,n)   (TEXT_LINE_W(w) | TEXT_LINE_N(n))

	extern const unsigned char Font_6_12[];
	extern const unsigned char Font_8_16[];
	extern const unsigned char Font_12_24[];
	extern const unsigned char Font_16_32[];
	extern const unsigned char Font_24_48[];
	extern const unsigned char Font_32_64[];
	extern const unsigned char Font_48_96[];
	extern const unsigned char Font_64_128[];

	void lcd_xh_init(void);
	void lcd_xh_disp_buff_set(uu8 *pbuff);
	void lcd_xh_font_set(uu8 Fontx, uu8 Fonty, const uu8 *Ascii); 
	void lcd_xh_half_en(void);
	void lcd_xh_half_dis(void);
	void lcd_xh_anti(void);
	void lcd_xh_normal(void);
	void lcd_xh_space_set(uu8 Space);
	void lcd_xh_origin_set(ii16 x0, ii16 y0);

	void lcd_xh_put_space(ii16 x, ii16 y, ii8 Amounts); 
	void lcd_xh_put_char(ii16 x, ii16 y, char DispCh); 
	void lcd_xh_put_cn(ii16 x, ii16 y, const uu8 *pCN); 
	void lcd_xh_puts(ii16 x, ii16 y, const char *DispStr);   
	void lcd_xh_put_nums(ii16 x, ii16 y, const char *DispStr);  
	void lcd_xh_put_cns(ii16 x, ii16 y, ii8 Amount, const uu8 *pCN); 
	void lcd_xh_dot_set(ii16 x, ii16 y);
	void lcd_xh_dot_clr(ii16 x, ii16 y);
	void lcd_xh_ram_fill(uu8 Val);
	void lcd_xh_line(ii16 x0, ii16 y0, ii16 x1, ii16 y1);
	void lcd_xh_square(ii16 x0, ii16 y0, ii16 x1, ii16 y1);
	void lcd_xh_square_fill(ii16 x0, ii16 y0, ii16 x1, ii16 y1);
	void lcd_xh_imgage_quick(ii16 x0, ii16 y0, ii16 wide, ii16 high, const uu8 *pImg);
	void lcd_xh_circle(ii16 x, ii16 y, ii16 r);

	void lcd_xh_alain_puts(ii16 x, ii16 y, const char *DispStr, uu16 mode);   
	void lcd_xh_alain_put_nums(ii16 x, ii16 y, const char *DispStr, uu16 mode);  
	void lcd_xh_alain_put_cns(ii16 x, ii16 y, ii8 Amount, const uu8 *pCN, uu16 mode); 
	dword_tt lcd_xh_alain_xy_get(ii16 x, ii16 y, const char *DispStr, ii16 cn_num, uu16 mode); 
	void lcd_xh_alain_sq_and_line(ii16 x, ii16 y, ii16 text_wide, uu16 mode);

	void lcd_xh_alain_ext_puts(ii16 x, ii16 y, const char *str, uu16 mode);
	extern const uu8 * lcd_xh_gb2312_cn_get(uu32 mem_offset, uu16 font_x); 

	void lcd_xh_poll(uu16 x0, uu16 y0, uu8 y_amount); 
	uu8 lcd_xh_update_cnt_get(void);

	void lcd_hal_init(void);
	
	void lcd_data_write(short y, short xoffset, uu8 const * pdata);

#ifdef	__cplusplus
}
#endif

#endif	

